Skip to content

feat(ebe): mpcv2 signing for all rounds#48

Merged
pranavjain97 merged 4 commits into
masterfrom
WP-5151-mpc-ecdsa-onprem-ebe
Jul 7, 2025
Merged

feat(ebe): mpcv2 signing for all rounds#48
pranavjain97 merged 4 commits into
masterfrom
WP-5151-mpc-ecdsa-onprem-ebe

Conversation

@pranavjain97

@pranavjain97 pranavjain97 commented Jun 27, 2025

Copy link
Copy Markdown
Contributor

Ticket: WP-5151

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for ECDSA MPCv2 signing by defining new request/response fields, implementing a multi‐round signing handler, and covering the flow with integration tests.

  • Extend the API spec to include ECDSA MPCv2 fields and response types
  • Implement handleEcdsaMpcV2Signing in the transaction handler with three MPC rounds
  • Add integration tests and helper utilities for ECDSA MPCv2; update dependencies for keccak hashing

Reviewed Changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/enclavedBitgoExpress/routers/enclavedApiSpec.ts Add ECDSA MPCv2-specific request fields and response unions
src/api/enclaved/handlers/signMpcTransaction.ts Implement multi-round ECDSA MPCv2 signing logic
src/tests/mocks/gpgKeys.ts Provide mock GPG key pairs for testing
src/tests/api/enclaved/signMpcTransaction.test.ts Add full integration tests for ECDSA MPCv2 rounds
src/tests/api/enclaved/ecdsaUtils.ts Provide helper functions to simulate BitGo MPCv2 signing
package.json Add keccak and its types for hashing in tests
Comments suppressed due to low confidence (3)

src/api/enclaved/handlers/signMpcTransaction.ts:75

  • [nitpick] Rename interface EcdsaSigningParams to EcdsaMpcV2SigningParams to clearly indicate its association with the MPCv2 signing flow.
interface EcdsaSigningParams {

src/api/enclaved/handlers/signMpcTransaction.ts:304

  • [nitpick] Correct the pluralization in this error message to 'are supported' to match the list of share types.
        `Share type ${shareType} not supported for MPCv2, only MPCv2Round1, MPCv2Round2 and MPCv2Round3 is supported.`,

src/tests/api/enclaved/signMpcTransaction.test.ts:385

  • [nitpick] The request property 'pub' is ambiguous; renaming it to 'userGpgPubKey' throughout would improve clarity for API consumers.
      };

// Unified parameters for handleEcdsaSigning - includes all possible fields
interface EcdsaSigningParams {
coin: BaseCoin;
shareType: string;

Copilot AI Jun 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the ShareType enum instead of a raw string for the shareType property in EcdsaSigningParams to improve type safety.

Suggested change
shareType: string;
shareType: ShareType;

Copilot uses AI. Check for mistakes.
Comment on lines +345 to +346
const [userShare, backupShare, bitgoShare] = await DklsUtils.generateDKGKeyShares();
assert(backupShare, 'backupShare is not defined');

Copilot AI Jun 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The backupShare variable is declared and asserted but not used in the test. Consider removing it or using it to avoid confusion.

Suggested change
const [userShare, backupShare, bitgoShare] = await DklsUtils.generateDKGKeyShares();
assert(backupShare, 'backupShare is not defined');
const [userShare, bitgoShare] = await DklsUtils.generateDKGKeyShares();

Copilot uses AI. Check for mistakes.
Comment thread src/types/keccak.d.ts Outdated
@@ -0,0 +1,7 @@
declare module 'keccak' {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is only used for tests so should this be moved to the tests folder?


switch (shareType.toLowerCase()) {
case ShareType.MPCv2Round1: {
const dataKey = await generateDataKey({ keyType: 'RSA-2048', cfg });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it AES for aws?

});
return await ecdsaMPCv2Utils.createOfflineRound3Share({
txRequest: params.txRequest,
prv: params.prv,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the prv meant to be unencrpyted or encrypted ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unencrypted

@pranavjain97 pranavjain97 force-pushed the WP-5151-mpc-ecdsa-onprem-ebe branch from e6d7635 to 082cac6 Compare June 30, 2025 20:59
@pranavjain97 pranavjain97 force-pushed the WP-5151-mpc-ecdsa-onprem-ebe branch from 082cac6 to 713f293 Compare July 4, 2025 15:28
Comment on lines +94 to +96
encryptedUserGpgPrvKey: t.union([t.undefined, t.string]),
encryptedRound1Session: t.union([t.undefined, t.string]),
encryptedRound2Session: t.union([t.undefined, t.string]),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can use optional(t.string)

@pranavjain97 pranavjain97 merged commit 0aaa530 into master Jul 7, 2025
3 checks passed
@pranavjain97 pranavjain97 deleted the WP-5151-mpc-ecdsa-onprem-ebe branch July 7, 2025 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants